<template>
  <div class="table-container">
    <div class="table-title">基本信息及建设成本</div>
    <div class="formula-detail">
      <el-collapse class="formula-collapse" v-model="activeNames" accordion @change="handleChange">
        <el-collapse-item title="公式详情" name="1">
          <div class="formula">风电总价F = 风力发电度数A * 风力单价B</div>
        </el-collapse-item>
      </el-collapse>
    </div>
    <el-table ref="tableRef" :data="tableData" border style="width: 100%">
      <!-- <el-table-column type="index" width="70" label="序号"></el-table-column> -->
      <el-table-column prop="category" label="收资条目" width="180"></el-table-column>
      <el-table-column prop="content" label="填写内容" width="280">
        <template #default="scope">
          <el-select
            v-if="scope.row.category == '场站类型'"
            v-model="scope.row.content"
            placeholder="请选择"
          >
            <el-option
              v-for="item in catOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
          <el-input v-else size="small" v-model="scope.row.content"></el-input>
        </template>
      </el-table-column>
      <el-table-column prop="desc" label="补充说明">
        <template #default="scope">
          <el-input size="small" v-model="scope.row.desc"></el-input>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script setup lang="ts">
import type { CollapseModelValue } from 'element-plus';

// 对象类型
export type IObject = Record<string, any>;

const activeNames = ref('1');
const handleChange = (val: CollapseModelValue) => {};

// 列表数据
const tableData = ref<IObject[]>([
  {
    category: '场站名称',
    content: '',
    desc: '',
  },
  {
    category: '场站类型',
    content: '陆上集中式风电',
    desc: '',
  },
  {
    category: '投运时间',
    content: '',
    desc: '',
  },
  {
    category: '装机容量（MW）',
    content: '',
    desc: '',
  },
  {
    category: '容配比（风电无需填写）',
    content: '',
    desc: '光伏组件标称功率与逆变器额定有功功率的比值，格式例如1:1',
  },
  {
    category: '资本性投入',
    content: '',
    desc: '',
  },
  {
    category: '借款投入',
    content: '',
    desc: '',
  },
  {
    category: '设备购置与安装',
    content: '',
    desc: '',
  },
  {
    category: '用地（用海）及基础设施',
    content: '',
    desc: '',
  },
  {
    category: '电网接入成本',
    content: '',
    desc: '',
  },
  {
    category: '软件系统支出',
    content: '',
    desc: '',
  },
  {
    category: '配建储能费用',
    content: '',
    desc: '若未配建储能，则不填写',
  },
  {
    category: '其他固定支出',
    content: '',
    desc: '',
  },
]);

const catOptions = reactive([
  {
    label: '陆上分散式风电',
    value: '1',
  },
  {
    label: '陆上集中式风电',
    value: '2',
  },
  {
    label: '近海风电(70km内)',
    value: '3',
  },
  {
    label: '深远海风电(70km外)',
    value: '4',
  },
  {
    label: '集中式光伏',
    value: '5',
  },
  {
    label: '分布式光伏',
    value: '6',
  },
  {
    label: '海上光伏',
    value: '7',
  },
]);
</script>

<style lang="scss" scoped>
.formula-detail {
  display: flex;
  justify-content: flex-end;
}
.formula-collapse {
  max-width: 100%;
  border-radius: 10px;
  background-color: #ffffff;
  padding-left: 10px;

  :deep(.el-collapse-item__header) {
    color: #4080ff;
    background-color: transparent;
  }
}
.formula {
  padding: 5px;
}
</style>